/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package sql;
import java.sql.*;

/**
 *
 * @author Donghui
 */
public class Insert {

    final String url = "jdbc:mysql://localhost/isc?user=root&password=root&useUnicode=true";
    private Connection insertOpt = null;
    private Statement insertStatement = null;
    private String sql;
    private String tp;
    private static Insert local;


    public static Insert getInstance(){
        if(local==null){
            local = new Insert();
        }
        return local;
    }

    
    public String insertValue(String temp)
    {
        sql=temp;
        try{
        Class.forName("com.mysql.jdbc.Driver");
        insertOpt = DriverManager.getConnection(url);
        insertOpt.setCatalog("isc");
        insertStatement=insertOpt.createStatement();
        insertStatement.executeUpdate(sql);
        insertStatement.close();
        insertOpt.close();
        tp="Y";
        }
        catch(Exception e)
        {
            e.printStackTrace();
            tp="N";
        }
        return tp;
    }

}
